home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Demos
/
Bowers Development
/
AppMaker 2.0b5
/
Examples
/
Procedural
/
Gadgets
/
Pallette.c
< prev
next >
Wrap
Text File
|
1996-03-19
|
2KB
|
126 lines
/* Pallette.c */
/* Created 01/01/95 12:01 PM by AppMaker */
#include <Types.h>
#include <Quickdraw.h>
#include <Controls.h>
#include <Dialogs.h>
#include <Events.h>
#include <Lists.h>
#include <Menus.h>
#include <Resources.h>
#include <TextEdit.h>
#include <ToolUtils.h>
#include "ResourceDefs.h"
#include "Globals.h"
#include "Miscellany.h"
#include "Scrolling.h"
#include "WindowAids.h"
#include "GadgetsData.h"
#include "Pallette.h"
#define ToolsPalette 1
/*----------*/
void OpenPallette (FSSpec* fileSpec,
short fRefNum)
{
WindowPtr newWindow;
Rect bounds;
newWindow = GetWindow (WIND_Pallette);
if (fileSpec->name [0] != 0) {
SetWTitle (newWindow, fileSpec->name);
}
SetPort (newWindow);
SetNewInfo (newWindow);
cur->vScroll = nil;
cur->hScroll = nil;
cur->fileNum = fRefNum;
cur->dirty = false;
cur->filename = NewString (fileSpec->name);
cur->windowKind = WPallette;
((WindowPeek) curWindow)->windowKind = userKind + WPallette;
cur->witlHandle = GetResource ('Witl', WIND_Pallette);
cur->wictHandle = GetResource ('Wict', WIND_Pallette);
cur->ToolsHandle = GetNewControl (CNTL_Tools, newWindow);
cur->ToolsChoice = GetCtlMin (cur->ToolsHandle);
cur->text = nil;
} /*OpenPallette*/
/*----------*/
void ClosePallette (void)
{
DisposHandle ((Handle) cur->filename);
DiscardInfo (curWindow);
} /*ClosePallette*/
/*----------*/
void ControlPallette (ControlHandle whichControl,
short whichPart,
Point where)
{
Rect bounds;
if (whichControl == cur->ToolsHandle) {
TrackPalette (cur->ToolsHandle, where, &cur->ToolsChoice);
}
} /*ControlPallette*/
/*----------*/
void MouseInPallette (Point where,
short modifiers)
{
Rect bounds;
} /*MouseInPallette*/
/*----------*/
void TypeInPallette (char ch)
{
if (cur->text == nil) {
SysBeep (1);
} else {
TEKey (ch, cur->text);
cur->dirty = true;
}
} /*TypeInPallette*/
/*----------*/
void UpdatePallette (void)
{
Rect bounds;
Draw1Control (cur->ToolsHandle);
DrawClippedGrow (-15, -15);
} /*UpdatePallette*/
/*----------*/
void ActivatePallette (Boolean activate)
{
DrawClippedGrow (-15, -15);
} /*ActivatePallette*/
/*----------*/
void ResizePallette (void)
{
/* application-specific code to resize items in window */
} /*ResizePallette*/
/*----------*/
pascal void ScrollPallette (short newValue,
short oldValue)
{
/* application-specific code to scroll window */
} /*ScrollPallette*/
/* Pallette */